#!/bin/bash
# 定义Kafka的地址和端口
KAFKA_HOST="10.139.139.123"
KAFKA_PORT="29092"

# 定义存储topic名称的文件路径
TOPICS_FILE="topics.txt"

# 读取文件中的每一行
while IFS= read -r topic
do
    # 创建topic
    ./kafka-topics.sh --create --bootstrap-server $KAFKA_HOST:$KAFKA_PORT --topic "$topic" --partitions 1 --replication-factor 1
    #echo "$topic"
done < "$TOPICS_FILE"